package com.googlecode.xpathproxy.conversion.base;

/**
 * Converts a nodes
 *
 * @author Ray Krueger
 */
public class EnumConverter extends AbstractInputStringConverter<Enum> {

    private final Class<? extends Enum> enumClass;

    public EnumConverter(Class<? extends Enum> enumClass) {
        this.enumClass = enumClass;
    }

    @SuppressWarnings("unchecked")
    protected Enum convertString(String input) {
        return Enum.valueOf(enumClass, input);
    }

    protected Class getSupportedType() {
        return enumClass;
    }
}
